/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.game.zone;

import log.Debug;
import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import extension.game.poker.PokerFlag;
import java.util.List;

/**
 *
 * @author daz
 */
public class Response {

    PokerZoneExtension ext;

    public Response(PokerZoneExtension ext) {
        this.ext = ext;
    }

    public void sendListTable(int dealer, int smallBlind, int bigBlind, long amountBlindBet, User users) {
    }

    void sendListTable(List<Integer> numberPlayerInRooms, List<String> listUserNames, List<String> listRoomNames, String groupName, List<User> user) {
        Debug.d("send list table to many user");
        ISFSObject resObj = new SFSObject();
        resObj.putUtfString(Flag.GROUP_NAME, groupName);
        resObj.putUtfStringArray(Flag.LIST_NAMES, listUserNames);
        resObj.putIntArray(Flag.LIST_NUMBER_IN_Table, numberPlayerInRooms);
        resObj.putUtfStringArray(Flag.ROOM_NAME, listRoomNames);
        ext.send(Command.LIST_TABLE, resObj, user);
    }

    void sendListTable(List<Integer> numberPlayerInRooms, List<String> listRoomNames, String groupName, User user) {
        ISFSObject resObj = new SFSObject();
        resObj.putUtfString(Flag.GROUP_NAME, groupName);
//        resObj.putUtfStringArray(Flag.LIST_NAMES, listUserNames);
        resObj.putIntArray(Flag.LIST_NUMBER_IN_Table, numberPlayerInRooms);
        resObj.putUtfStringArray(Flag.ROOM_NAME, listRoomNames);
        ext.send(Command.LIST_TABLE, resObj, user);
        Debug.d("send list table info");
        log(resObj);
    }

    void sendTableInfo(String roomName, List<String> listNames, List<Integer> listPos, User user) {
        ISFSObject resObj = new SFSObject();
        resObj.putUtfString(Flag.ROOM_NAME, roomName);
        if (listNames != null) {
            Debug.d("send table info");
            resObj.putUtfStringArray(PokerFlag.ROOM_PLAYER_NAME, listNames);
            resObj.putIntArray(PokerFlag.ROOM_PLAYER_POS, listPos);
            ext.send(Command.TABLE_INFO, resObj, user);
            Debug.d(resObj.getDump());
        }
    }

    private void log(ISFSObject resObj) {
        Debug.d(resObj.getDump());
    }
}
